<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


<style type="text/css">
    #hd_debug {
        padding: 10px;
        margin: 0px;
        font: 12px/20px "微软雅黑";
        clear: both;
        border: solid 1px #dcdcdc;
        margin: 20px;
        background-color: #fff;
        width: 800px;
        word-wrap: word-break;
        word-break: break-word;
        display: < ? php echo C("DEBUG_SHOW") ? 'block' : 'none' ? >;
    }

    #hd_debug * {
        margin: 0px;
        padding: 0px;
    }

    #hd_debug table td {
        font-size: 12px;
    }

    #hd_debug tr {
        word-break: break-all;
    }

    #hd_debug .debug_link {
        border-bottom: solid 1px #dcdcdc;
        padding-bottom: 6px;
        margin-top: 0px;
    }

    #hd_debug .debug_link a {
        padding: 0px 8px;
        text-decoration: none;
    }

    #hd_debug .debug_link a:hover {
        text-decoration: underline;
    }

    #hd_debug .debug_server {
        line-height: 1.5em;
        margin-bottom: 10px;
        color: #333;
    }

    #hd_debug .debug_server table {
        width: 100%;
        border: none;
    }

    #hd_debug .debug_server table td {
        border: none;
        padding: 3px 0px;
        border-bottom: solid 1px #eee;
    }

    #hd_debug .debug_server a {
        color: #5d5d5d;
        text-decoration: none;
    }

    #hd_debug .debug_server a:hover {
        color: #5d5d5d;
        text-decoration: underline;
    }

    #hd_debug fieldset {
        line-height: 1.2em;
    }

    #hd_debug a {
        color: #2F68A5;
    }

    #hd_debug table {
        border-collapse: collapse;
        border: solid 1px #efefef;
        overflow: hidden;
    }

    #hd_debug table thead td {
        background-color: #efefef;
        color: #000;
        padding: 3px 5px;

    }

    #hd_debug table tbody td {
        color: #333;
        padding: 3px;
        border-bottom: solid 1px #efefef;
    }

    #hd_debug fieldset {
        padding: 10px;
        border: 1px solid #D0D0D0;
        margin-top: 10px;
    }

    #hd_debug legend {
        padding: 5px;
        border: none;
        width: 55px;
        font-size: 12px;
        line-height: 10px;
    }

    #hd_debug_bt {
        width: 80px;
        height: 30px;
        text-align: center;
        line-height: 2em;
        border-radius: 5px;
        background: #D55021;
        color: #fff;
        position: absolute;
        right: 20px;
        bottom: 20px;
        cursor: pointer;
        box-shadow: 0px 0px 5px #666;
    }
</style>

<!--右下角图标-->
<!--
<div id="hd_debug_bt">
HDPHP
</div>-->
<!--右下角图标-->
<div id="hd_debug">
    <div class="debug_link">
        <a href='<?php echo dirname(__HDPHP__).'/Setup/index.php'?>?c=rbac'
        target='_blank'>配置RBAC</a>
        <a href='<?php echo dirname(__HDPHP__).'/Setup/index.php'?>?c=session&path_root=%2Fwww%2Fhdphp%2Fexample%2FApp%2F&app=http%3A%2F%2Flocalhost%2Fhdphp%2Fexample%2FApp%2Findex.php%2F1%2FIndex%2Findex'
        target='_blank'>配置SESSION</a>
        <a href='<?php echo dirname(__HDPHP__).'/Setup/index.php'?>?m=delcache&temp=<?php echo realpath(TEMP_PATH);?>
        '>删除缓存数据</a>
        <a href="javascript:void(0)" onclick='document.getElementById("hd_debug").style.display="none"'>隐藏</a>
    </div>
    <!--系统信息-->
    <?php if(C("SHOW_SYSTEM")):?>
    <fieldset>
        <div class='debug_server'>
            <table>
                <tr>
                    <td>服务器信息</td>
                    <td><?php echo $_SERVER['SERVER_SOFTWARE'];?></td>
                </tr>
                <tr>
                    <td>客户端代理</td>
                    <td><?php echo $_SERVER['HTTP_USER_AGENT'];?></td>
                </tr>
                <tr>
                    <td>PHP版本</td>
                    <td><?php echo PHP_VERSION;?></td>
                </tr>
                <tr>
                    <td>请求方式</td>
                    <td><?php echo $_SERVER['REQUEST_METHOD'];?></td>
                </tr>
                <tr>
                    <td>通信协议</td>
                    <td><?php echo $_SERVER['SERVER_PROTOCOL'];?></td>
                </tr>
                <tr>
                    <td>当前脚本</td>
                    <td>./Hdcms/App/1/IndexControl.php</td>
                </tr>
                <tr>
                    <td>会话ID</td>
                    <td>i9unjpabldmpr35prt88laebc7</td>
                </tr>
                <tr>
                    <td>框架版本</td>
                    <td><?php echo HDPHP_VERSION?>
                        <a href='http://www.hdphp.com/version.php?ver=<?php echo str_replace(".","",HDPHP_VERSION)?>'
                           target='_blank'>查看新版</a>
                    </td>
                </tr>
            </table>
        </div>
    </fieldset>
    <?php endif;?>
    <!--显示缓存统计-->
    <?php if(self::$tpl && C("SHOW_TPL_COMPILE")):?>
    <!--模板编译文件-->
    <fieldset>
        <legend>模板编译</legend>
        <table width="100%">
            <thead>
            <tr>
                <td style="width:80px;">模板文件</td>
                <td>编译文件</td>
            </tr>
            </thead>
            <?php foreach (self::$tpl as $k => $v):?>
            <tr>
                <td style="font-size:12px;width:80px;padding:6px;"><?php echo $v[0]?></td>
                <td style="font-size:12px;padding:6px;">
                    <?php echo str_replace(array(" / ", "\\"), DS, $v[1])?>
                </td>
            </tr>
            <?php endforeach;?>
        </table>
    </fieldset>
    <?php endif;?>
    <!--数据库-->
    <?php  if(!empty(self::$sqlExeArr) && C("SHOW_SQL")):?>
    <fieldset>
        <legend>SQL查询</legend>
        <table width=100%>
            <thead>
            <tr>
                <td>顺序</td>
                <td>SQL命令</td>
            </tr>
            </thead>
            <?php foreach (self::$sqlExeArr as $k => $v):?>
            <tr>
                <td width='35'>[<?php echo $k+1?>]</td>
                <td><?php echo htmlspecialchars($v)?></td>
            </tr>
            <?php endforeach;?>
        </table>
    </fieldset>
    <?php endif;?>
    <!--数据库-->
    <!--缓存记录-->
    <?php  if(self::$cache['write_s'] && C("SHOW_CACHE")):?>
    <fieldset>
        <legend>缓存Cache</legend>
        <table width=100%>

            <tr>
                <td width="30" style='background:#ececec;color:#333;padding-left:5px;'>写入</td>
                <td width="80"> 成功:<?php echo self::$cache['write_s'];?>次</td>
                <td width="80">失败:<?php echo self::$cache['write_f'];?>次</td>
                <td>
                    命中:<?php echo self::$cache['write_s']+self::$cache['write_f']?round(self::$cache['write_s']/(self::$cache['write_s']+self::$cache['write_f'])*100,2)."%":0;?></td>
            </tr>
            <tr>
                <td style='background:#ececec;color:#333;padding-left:5px;'>读取</td>
                <td> 成功:<?php echo self::$cache['read_s'];?>次</td>
                <td>失败:<?php echo self::$cache['read_f'];?>次</td>
                <td>
                    命中:<?php echo self::$cache['read_s']+self::$cache['read_f']?round(self::$cache['read_s']/(self::$cache['read_s']+self::$cache['read_f'])*100,2)."%":0;?></td>
            </tr>
        </table>
    </fieldset>
    <?php endif;?>
    <!--缓存记录-->
    <?php if(C("SHOW_INCLUDE")):?>
    <fieldset>
        <legend style=''>引导流程</legend>
        <table width=100%>
            <thead>
            <tr>
                <td width="30">ID</td>
                <td>File</td>
            </tr>
            </thead>
            <?php $id=1;foreach($debug['file'] as $f=>$d):?>
            <tr>
                <td>[<?php echo $id++;?>]</td>
                <td><?php echo $f;?></td>
            </tr>
            <?php endforeach;?>
        </table>
    </fieldset>
    <?php endif;?>
    <fieldset class="runtime">
        执行时间 : <?php echo $debug['runtime'];?> &nbsp;
        &nbsp;
        内存峰值 : <?php echo $debug['memory'];?></fieldset>
</div>
<script>
    document.getElementById("hd_debug_bt").onclick = function () {
        var st = document.getElementById("hd_debug").style.display == "block" ? true : false;
        if (st) {
            document.getElementById("hd_debug").style.display = "none";
            window.scrollTo(0, 0);
        } else {
            document.getElementById("hd_debug").style.display = "block";
            window.scrollTo(0, document.title = document.getElementById("hd_debug").offsetTop);
        }
        debug_bottom();
    };
    window.onscroll = function () {
        debug_bottom();
    }
    //按钮移动到底部
    function debug_bottom() {
        var h = document.body.scrollTop + document.body.clientHeight - 50;
        document.getElementById("hd_debug_bt").style.top = h + "px";
    }
</script>
<script language="javascript" type="text/javascript" defer="defer">
    javascript:(function () {
        var D = document;
        F(D.body);
        function F(n) {
            var u, r, c, x;
            if (n.nodeType == 3) {
                u = n.data.search(/\S{10}/);
                if (u >= 0) {
                    r = n.splitText(u + 10);
                    n.parentNode.insertBefore(D.createElement("WBR"), r);
                }
            } else if (n.tagName != "STYLE" && n.tagName != "SCRIPT") {
                for (c = 0; x = n.childNodes[c]; ++c) {
                    F(x);
                }
            }
        }
    })();
</script>